<!DOCTYPE html><html><head><meta charset="utf-8">
<title>兴趣小组大全</title><meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="css/mui.min.css">
<style type="text/css">
#list {margin-top: -1px;}
   .mui-bar .mui-pull-left .mui-icon {
    padding-right: 5px;
    font-size: 28px;
   }
   .mui-bar .mui-btn {
    font-weight: normal;
    font-size: 17px;
   }
   .mui-bar .mui-btn-link {
    top: 1px;
   }
   .mui-scroll { height: 28px; line-height: 28px; overflow: hidden;}
   .mui-scroll a{padding: 5px;}
   .red{color:#FF0000}
   .no{ background-color:#FFFFFF}
   .lititle{line-height:24px;  font-weight:bold; font-size:14px;overflow:visible}
   .liimg{width:80px; height:80px;}
   #pullrefresh{ padding-bottom:60px;}
   .modetext{color:#FF0000;;border: thin solid #FF0000; margin-right:20px;}
   .nomodetext{color:#666666;;border: thin solid #666666; margin-right:20px;}
   .mui-scroll-wrapper{background-color:#FFFFFF;}
      .mui-content-padded {
				margin-top: 25px;
			}
			 .hy-box{background-color:#FFFFFF; padding:10px;}
			 .mui-input-row{margin:5px; padding:10px;}
</style>
 </head>
 <body>
<header id="header" class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">兴趣小组大全</h1>
</header>
<div id="pullrefresh" class="mui-content mui-scroll-wrapper"><ul class="pullrefresh-view mui-table-view mui-table-view-chevron" id="mui-table-view">
<li class="mui-table-view-cell mui-media"><a class="mui-btn mui-btn-primary" id="add">免费创建小组</a><p class="mui-ellipsis">简化版个人网站</p></div></li>

</ul></div></div>

<div id="add_f_div" class="mui-popover mui-popover-bottom mui-popover-action">
<div class="hy-box" style="font-size: 16px;">
<form class="mui-input-group">
<div class="mui-input-row"><label>名称</label><input id='name' type="text" class="mui-input" placeholder="小组名称"></div>
</form>		
<a id='add_f_div_b' class="mui-btn mui-btn-block mui-btn-primary">创建</a>
</div>	
</div>
<script src="js/mui.min.js"></script>
<script src="config.js"></script>
<script>
var groupmy=[];
var optionss=localStorage.getItem("groupmy");  
if(optionss){groupmy=JSON.parse(optionss);}

function pullupRefresh() { 
 if(ajaxbool){mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); return;}
ajaxbool=true;
mui.post('https://www.ysv8.com/open/forum_all?lang='+lang,{pageid:pagtime,YSV8_HEX:ysv8hex},function(data2){ 
var table = document.body.querySelector('.pullrefresh-view');    
var loadi=0;
if(typeof(data2['hex'])!="undefined"){ 
	rndhex=data2['hex'];
 localStorage.setItem("rndhex",data2['hex']);
 }
if(typeof(data2['mygroup'])!="undefined"){ 
if(data2['mygroup'].length>0){
data2['mygroup'].unshift({name:'问答',id:-1,size:1},{name:'广场',id:0,size:3});
groupmy=data2['mygroup'];
    localStorage.setItem("groupmy",JSON.stringify(groupmy));
}
}
 
 
data=data2['data'];
for (i = 0;i < data.length; i++) {
loadi++;
data[i]['atime']= Number(data[i]['atime']);
 if(pagtime>data[i]['atime'] || pagtime==0){pagtime=data[i]['atime']}
thisgold='';
thismy='';
if(data[i]['gold']>0){
thisgold='<span class="modetext">'+data[i]['gold']+'</span>';
}
if(in_group(data[i]['id'])){
thismy='<a class="modetext mui-pull-right" id="'+data[i]['id']+'" dataname="'+data[i]['name']+'">已关注</a>';
}else{
thismy='<a class="nomodetext mui-pull-right" id="'+data[i]['id']+'" dataname="'+data[i]['name']+'">关注</a>';
}
var li = document.createElement('li');
      li.className = 'mui-table-view-cell mui-media';
      li.innerHTML = '<img class="mui-media-object mui-pull-left" src="'+data[i]['img'].replace('{m}','https://i.ysv8.com/upload/')+'_80"><div class="mui-media-body">'+data[i]['name']+'<p class="mui-ellipsis">'+thisgold+thismy+'</p></div>';
      table.appendChild(li);
  }
 mui.toast('成功加载'+loadi+'条记录',{ duration:'short', type:'div' });
if(loadi<10){
mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);  

var li = document.createElement('li');
      li.className = 'mui-table-view-cell mui-media';
      li.innerHTML = '<p style="text-align:center">全部加载完毕</p>';
      table.appendChild(li);
}else{
mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); 
}
ajaxbool=false
 },'json'
);
   }
mui.init({
	beforeback: function(){
if(typeof(plus)!="undefined"){ 
		var list = plus.webview.getLaunchWebview();
		list.reload();
		return true;
		}else{
		history.go(-1);location.reload();
		return false;
		}
	},
    pullRefresh: {
     container: '#pullrefresh',
     up: {
      callback: pullupRefresh
     }
    }
   });
 (function($){
 $.ready(function() {
 ajaxbool=false;
setTimeout(function() {pullupRefresh();}, 1500);
  });
  
  
  mui("#add_f_div").on('tap','a',function(){/*创建小组*/
 mui.post('https://www.ysv8.com/open/add_f',{name:document.getElementById('name').value,YSV8_HEX:ysv8hex,rndhex:rndhex},function(data){ 
if(data['error']==false){
mswal(data);
  return false;
  }
   add_f(data['id'],document.getElementById('name').value,'add');
mui.alert('创建成功');
mui('#add_f_div').popover('toggle');
 },'json'
);
  
  
  
  
  });
  
mui(".mui-content").on('tap','a',function(){/*关注*/
 var thisself=this;
id = this.getAttribute("id");

if(id=='add'){

mui('#add_f_div').popover('toggle');
return false;
}

 mui.post('https://www.ysv8.com/open/f_state',{id:id,YSV8_HEX:ysv8hex,rndhex:rndhex},function(data){ 
  if(data['error']==false){
   mswal(data);
  return false;
  }
 if(data['id']){
 //删除id
 
 add_f(id,thisself.getAttribute('dataname'),'add');
 thisself.setAttribute("class", "modetext mui-pull-right"); 
 thisself.innerHTML="已关注";
 }else{
 add_f(id,thisself.getAttribute('dataname'),'del');
  thisself.setAttribute("class", "nomodetext mui-pull-right"); 
 thisself.innerHTML="关注";
 }
 },'json'
);
});  
     
})(mui);    
  </script>
 </body>

</html>